<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>javascript 阶段</title>
    <style>
        body {
            font-size: 50px;
        }
    </style>
</head>
<body>

    <div class="container">
        <span>DOM对象</span>
    </div>

    <script>
        // 获取父元素
        var container = document.querySelector(".container");
        // 获取子元素
        var span = document.querySelector(".container span");

        // 方式1:
        var ele = container.removeChild(span);
        console.log(ele);//  <span>DOM对象</span>

        // 方式2:
        // var res = span.remove();
        // console.log(res);// undefined

        
    </script>
</body>
</html>